<?php
/**
 * create by sqb 2018/11/26
 */
namespace Admin\Models\homeset;

use Admin\Models\BaseModel;

class XhhomeSet extends BaseModel
{
    /**
     * @var integer
     */
    public $iId;

    /**
     * @var string
     */
    public $sName;

    /**
     * @var string
     */
    public $sPowerTag;

    /**
     * @var string
     */
    public $sUrl;

    /**
     * @var integer
     */
    public $sGetMethod;

    /**
     * @var string
     */
    public $sModel;

    /**
     * @var integer
     */
    public $iIsDefault;

    /**
     * @var string
     */
    public $tCreateDate;

    /**
     * @var integer
     */
    public $iCreateUserId;

    /**
     * @var string
     */
    public $tLastModifyDate;

    /**
     * @var integer
     */
    public $tLastModifyUserId;

    /**
     * @var integer
     */
    public $bDelete;

    public function initialize()
    {
        parent::initialize();
        $this->setSource('XHSys_HomeSet');
    }

    /**
     * @return string
     */
    public function getSource()
    {
        return 'XHSys_HomeSet';
    }

    /**
     * @param null $parameters
     * @return \Phalcon\Mvc\Model\ResultsetInterface
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }

    /**
     * @param null $parameters
     * @return \Phalcon\Mvc\Model
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }

    /**
     * @return int
     */
    public function getId()
    {
        return $this->iId;
    }

    /**
     * 获取模块名
     *
     * @return array
     */
    public static function getModelName()
    {
        $obj = self::find();

        $model = [];
        foreach ($obj as $item) {
            $model[$item->sModel] = $item->sModel;
        }

        return array_unique($model);
    }
}
